2023-08-08 08:50:58
An fstab entry.
The following /etc/fstab
entry is placed on your client machine, connecting you to your remote machine using SSH keys:
sshfs
will have to be installed on your client in order for this to work. This can be done through your distro's package manager.
sshfs#{REMOTE}@{IP_ADDRESS}:/mnt/{REMOTE_DIR} /mnt/{CLIENT_DIR} fuse ServerAliveInterval=1,reconnect,port={PORT},defaults,_netdev,IdentityFile=/home/{CLIENT}/.ssh/id_rsa,allow_other,nofail 0 0
The port
option can be ommited if the default SSH port is used.
The nofail
option is important. If you client can't connect for whatever reason, your entire system won't halt due to a boot failure.
reconnect
and ServerAliveInterval=1
are also important. These are used to ensure your machine doesn't halt in case the server/remote disconnects while the connection is in use.